package com.adteam.xmap.web;

import java.util.List;

import com.adteam.xmap.entity.Campus;
import com.adteam.xmap.manager.CampusManager;
import com.opensymphony.xwork2.ActionSupport;

public class CampusAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private CampusManager campusManager;
	
	private Campus campus;
	
	private List campuses;
	
	private Integer id;

	@Override
	public String execute() throws Exception {
		
		campuses = campusManager.findAllCampuses();
		return "SUCCESS";
	}
	
	public String addInput() {
		
		return "add_input";
	}
	
	public String add() {
		
		campusManager.addCampus(campus);
		return "add_success";
	}
	
	public String del() {
		
		campusManager.delCampus(id);
		return "del_success";
	}
	
	public String updateInput() {
		
		return "update_input";
	}
	
	public String update() {
		
		campusManager.updateCampusg(campus);
		return "update_success";
	}
	
	public String find() {
		
		campus = campusManager.findCampusById(id);
		return "find_success";
	}

	public CampusManager getCampusManager() {
		return campusManager;
	}

	public void setCampusManager(CampusManager campusManager) {
		this.campusManager = campusManager;
	}

	public Campus getCampus() {
		return campus;
	}

	public void setCampus(Campus campus) {
		this.campus = campus;
	}

	public List getCampuses() {
		return campuses;
	}

	public void setCampuses(List campuses) {
		this.campuses = campuses;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

}
